<?php

require_once 'subscribe.inc';
require_once 'params.inc';

assert($par->exist('do'));
$do = $par->get('do');

try
{
	switch ($do)
	{
	case 'add':
		Subsciption::add( $par->get('email') );
		break;
		
	case 'confirm':
		Subsciption::confirm( $par->get('id') );
		break;
		
	case 'delete':
		Subsciption::delete( $par->get('id') );
		break;
		
	case 'send':
		Subsciption::sendAll();
		break;
	};
	
	$link = '/';
	if ($par->exist('go'))
	{
		$link = $par->get('go');
	}
	
	header("Location: $link");
}
catch(Exception $e)
{
	echo $e->getMessage();
}

?>